From: Wei Liu Date: Wed, 25 Feb 2015 14:56:04 +0000 (+0000) Subject: gentypes: make dispose function tolerate NULL X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~3682 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=a5dfa16ba4acf1d8994f462b2b8c9ab4c4f147d2;p=xen.git gentypes: make dispose function tolerate NULL Signed-off-by: Wei Liu Cc: Ian Campbell Cc: Ian Jackson Acked-by: Ian Campbell --- diff --git a/tools/libxl/gentypes.py b/tools/libxl/gentypes.py index afd4eeab03..00816c0aef 100644 --- a/tools/libxl/gentypes.py +++ b/tools/libxl/gentypes.py @@ -642,6 +642,7 @@ if __name__ == '__main__': for ty in [t for t in types if t.dispose_fn is not None and t.autogenerate_dispose_fn]: f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p"))) f.write("{\n") + f.write(" if (!p) return;\n") f.write(libxl_C_type_dispose(ty, "p")) f.write(" memset(p, 0, sizeof(*p));\n") f.write("}\n")